package TestPageBean;

import java.util.ArrayList;
import java.util.List;

import com.mysql.fabric.xmlrpc.base.Array;

public class MainPage {
	public static void main(String[] args) {
		PageBean pb=new PageBean();
		List list=new ArrayList();
		for(int i=1;i<=30;i++){
			list.add(i);
		}
		pb.setCount(30);
		
		System.out.println(pb.getTotalPage());
		PositionCurr(28,list);
	}
	
	public static void PositionCurr(int currPage, List list){
			if(currPage!=0){//当当前页非等于0时候
				if(currPage-2<=0){//判断下边界是否越界
					for (int i=0;i<5;i++) {
						System.out.print(list.get(i)+"\t");
					}
				}else if(currPage+2>list.size()){//判断上边界是否越界
					for (int i=list.size()-4;i<=list.size();i++) {
						System.out.print(list.get(i-1)+"\t");
					}
				}else{//一般情况下中的显示
					for(int i=currPage-2;i<=currPage+2;i++){
						System.out.print(list.get(i-1)+"\t");
					}
				}
				
				
			}
	}
}
